package com.coocaa.ops.api.base.third.media.content.feign;

import com.coocaa.ops.api.base.third.FeignServiceNameConstants;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @author zen
 * @date 2020-08-04 16:43
 * @description
 */
@Slf4j
@Component
public class GetBizDataFallBackFactory implements FallbackFactory<GetBizDataFeignClient> {
    @Override
    public GetBizDataFeignClient create(Throwable cause) {
        GetBizDataFeignClient getBizDataFeignClient = (@RequestBody String json) -> {
            log.error(FeignServiceNameConstants.BIZ_DATA_SERVICE + " 出现问题: " + cause.toString() + ", 进行熔断处理!");
            return "";
        };
        return getBizDataFeignClient;
    }
}
